function showDiv() {  /*保存原有的div并添加新的div*/
    var content = "<div id='add'>动态添加div<br><input type='button' name='show'  value='点击看看' class='show'/></div>";
    var contentNumber='';
    for(var i=1;i<=3;i++){//添加多少个div在body中
        contentNumber=content+contentNumber;
    }
    var get = document.getElementsByTagName("body");
    var button = document.getElementById("button").innerHTML;
    get[0].innerHTML = button + contentNumber;

    var show = document.getElementsByClassName('show');
    for (var i = 0; i < show.length; i++) {
        show[i].num = i;
        show[i].addEventListener('click', function () {
            alert("点击第 "+this.num+" 个")
        }, false);
    };
}

var bigDiv=document.getElementsByClassName('big');
bigDiv[0].addEventListener('click',showDiv());



